package com.kobe.game_20;

import java.math.BigDecimal;

/**
 * 
 * n! means n (n 1) ... 3 2 1
 * 
 * Find the sum of the digits in the number 100!
 * 
 * 
 */
public class Game20 {
    public static void main(String[] args) {
        String result = getResult(100).toString();
        long resultValue = 0L;
        for (int i = 0; i < result.length(); i++) {
            String tempString = result.substring(i, i + 1);
            resultValue = resultValue + Integer.valueOf(tempString);
        }
        System.out.println(resultValue);
    }

    private static BigDecimal getResult(int number) {
        BigDecimal m = new BigDecimal(1);
        for (int i = 2; i <= number; i++) {
            m = m.multiply(new BigDecimal(i));
        }
        return m;
    }
}
